export default {
  state: {
    isCollapse: false, //控制菜单的展开还是收起
    tabList: [{
      path: '/HomePage',
      name: '首页',
      icon: 's-home'
    }] //面包屑
  },
  mutations: {
    // 修改菜单的方法
    collapseMenu (state) {
      state.isCollapse = !state.isCollapse
    },
    // 跟新面包屑数据
    selectMenu (state, val) {
      // 判断添加的数据是不是首页
      if (val.name !== '首页') {
        const index = state.tabList.findIndex(item => item.name === val.name)
        // 如果不存在
        if (index === -1) {
          state.tabList.push(val)
        }
      }
    },
    closeTag (state, item) {
      const index = state.tabList.findIndex(val => val.name == item.name)
      state.tabList.splice(index, 1)
    }
  },

}

